Skip to content

Refactor planner node-type logic into node_types package#410

Merged
zhongkaifu merged 2 commits into
mainfrom
codex/refactor-structure.py-to-modularize-node-types
Feb 8, 2026
Merged

Refactor planner node-type logic into node_types package#410
zhongkaifu merged 2 commits into
mainfrom
codex/refactor-structure.py-to-modularize-node-types

Conversation

@zhongkaifu
Copy link
Copy Markdown
Owner

Motivation

  • Organize node-type specific constants and helpers out of the large structure.py to improve modularity and readability.
  • Centralize schema building and sanitization logic per node type so maintenance and future extensions are easier.

Description

  • Added a new velvetflow/planner/node_types/ package with modules for each node type: action.py, condition.py, data.py, loop.py, reasoning.py, and switch.py and a central __init__.py that re-exports utilities.
  • Moved data-node schema construction into node_types/data.py as build_data_node_output_schema and loop-related helpers into node_types/loop.py (extract_loop_body_context, validate_loop_exports, fallback_loop_exports, ensure_loop_items_fields).
  • Implemented shared param/field sanitization in node_types/sanitizers.py (previously _filter_supported_params, _sanitize_builder_node_params, _sanitize_builder_node_fields) and updated structure.py to import and use filter_supported_params, sanitize_builder_node_params, sanitize_builder_node_fields, and build_data_node_output_schema from the new package.
  • Removed the old in-file node-type constants and duplicated helper implementations from structure.py, updated call sites to the new function names, and kept existing behavior/validation logic intact.

Testing

  • Ran bytecode compilation for changed modules with python -m compileall velvetflow/planner/structure.py velvetflow/planner/node_types, which completed successfully.
  • Performed a lightweight runtime import check with python - <<'PY'\nfrom velvetflow.planner.structure import plan_workflow_structure_with_llm\nprint('ok')\nPY, which printed ok indicating the planner entrypoint imports and basic wiring are functional.

Codex Task

@zhongkaifu zhongkaifu merged commit f1bce03 into main Feb 8, 2026
1 check failed
@zhongkaifu zhongkaifu deleted the codex/refactor-structure.py-to-modularize-node-types branch February 8, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant